Skip to content

feat: implicit user preference learning from conversation log (#54)#64

Merged
rockfordlhotka merged 1 commit into
mainfrom
feature/implicit-preference-learning
Feb 20, 2026
Merged

feat: implicit user preference learning from conversation log (#54)#64
rockfordlhotka merged 1 commit into
mainfrom
feature/implicit-preference-learning

Conversation

@rockfordlhotka

Copy link
Copy Markdown
Member

Summary

  • Adds a long-term conversation log (IConversationLog / FileConversationLog) that accumulates all conversation turns as JSONL
  • Adds a new dream-sequence pass (RunPreferenceInferencePassAsync) that analyzes the log for durable user preference patterns and saves them as tagged inferred memory entries
  • Log is always cleared after each pass to prevent unbounded growth
  • Preference inference is opt-in via WithConversationLog() — existing agents are unaffected

New files

File Purpose
ConversationLogEntry.cs Sealed record (SessionId, Role, Content, Timestamp)
IConversationLog.cs Interface: AppendAsync, ReadAllAsync, ClearAsync
ConversationLogOptions.cs Options: BasePath = "conversation-log"
FileConversationLog.cs JSONL implementation (turns.jsonl), thread-safe via SemaphoreSlim
FileConversationLogTests.cs 7 tests: round-trip, clear, missing file, concurrent appends

Modified files

  • DreamOptions.cs — added PreferenceInferenceEnabled (default true) and PreferenceDirectivePath ("pref-dream.md")
  • FileConversationMemory.cs — fire-and-forgets AppendAsync on every AddTurnAsync when log is wired in
  • DreamService.cs — preference inference pass with sentiment-based thresholds, built-in directive, finally-guarded log clear
  • AgentMemoryExtensions.cs — added WithConversationLog() explicit opt-in extension

Usage

builder.WithMemory();
builder.WithConversationLog();   // opt-in
builder.WithDreaming();

Test plan

  • dotnet build RockBot.slnx — clean build, 0 errors
  • dotnet test RockBot.slnx — all 539 tests pass, 0 failures
  • 7 new FileConversationLogTests all pass (round-trip, clear, concurrent appends, missing file)

🤖 Generated with Claude Code

Adds a long-term conversation log and a new dream-sequence pass that
analyzes accumulated turns for durable preference patterns, saves them
as tagged `inferred` memory entries, and clears the log after each pass.

- New abstractions: ConversationLogEntry, IConversationLog, ConversationLogOptions
- FileConversationLog: JSONL-based store (turns.jsonl), SemaphoreSlim thread safety
- FileConversationMemory: fire-and-forget log writes on every AddTurnAsync
- DreamService: RunPreferenceInferencePassAsync with sentiment thresholds,
  built-in pref directive, always-clear log in finally block
- DreamOptions: PreferenceInferenceEnabled + PreferenceDirectivePath
- AgentMemoryExtensions.WithConversationLog(): explicit opt-in extension
- 7 new tests for FileConversationLog (round-trip, clear, concurrent appends)

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
@rockfordlhotka rockfordlhotka merged commit ae57232 into main Feb 20, 2026
2 checks passed
@rockfordlhotka rockfordlhotka deleted the feature/implicit-preference-learning branch February 20, 2026 11:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant